/**
 *                     Remixvym (version 0.8.3)
 *             Copyright (c) 2010 by RemixLab, DISI-UNAL
 *            http://www.disi.unal.edu.co/grupos/remixlab/
 *
 * This Java package provides classes to visualize Mind Maps created in VYM
 * (View Your Mind) in a Processing Sketch
 *
 * @author Alvaro Lopez, Juan Baquero
 *
 * This source file is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 3 of the License, or (at your option)
 * any later version.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * A copy of the GNU General Public License is available on the World Wide Web
 * at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by
 * writing to the Free Software Foundation, 51 Franklin Street, Fifth Floor
 * Boston, MA 02110, USA
 */
package remixlab.remixvym.core.graphics.node;

import processing.core.PApplet;
import remixlab.remixvym.core.mindmap.Node;

/**
 * This class draws the node borders like ovals.
 * <p>
 * Extends {@link remixlab.remixvym.core.graphics.node.NodeShape}<p>
 * <b>See examples: </b> NodeStyle
 */
public class OvalNode extends NodeShape{
	/**
	 * Draws the node border like ovals.
	 * <p>
	 * 
	 * @param node
	 * @param parent
	 */
	public void draw(Node node, PApplet parent){
		//draw oval
		float centerX,centerY;
		centerX=node.x2-node.x1;
		centerX=centerX/2;
		centerX+=node.x1;
		
		centerY=node.y2-node.y1;
		centerY=centerY/2;
		centerY+=node.y1;
		
		parent.smooth();
		parent.ellipseMode(PApplet.CENTER);
		parent.ellipse(centerX, centerY, node.x2-node.x1,node.y2-node.y1);
	}
}
